package com.rajaev.dtu.tractor.domain.vo;



import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Created with IDEA
 * @author: tianjie
 * @Date:2019/6/14
 * @Time:15:54
 */
@Getter
@Setter
public class StatisticResultVo {

    /**
     * 开始日期
     */
    private Integer startDate;

    /**
     * 结束日期
     */
    private Integer endDate;


    /**
     * 平均耗电量
     */
    private BigDecimal avgDischarge;


    /**
     * 平均在线时长
     */
    private BigDecimal avgOnlineTime;


    /**
     * 平均开机率
     */
    private BigDecimal avgOnlineRatio;

    /**
     * 耗电前十的 电池
     */
    private List<Battery> top10DischargeList;

    /**
     * 充电电前十的 电池
     */
    private List<Battery> top10ChargeList;



    private TodayInfo todayInfo;

    private List<DailyAvgInfo> dailyAvgInfoList;

    /**
     * 基准耗电量（耗电量基线）
     */
    private BigDecimal baseDischarge;


    /**
     * 基准充电量（充量基线）
     */
    private BigDecimal baseCharge;

    @Getter
    public static class TodayInfo{
        /**
         * 当日耗电量
         */
        private BigDecimal todayDischarge;

        private BigDecimal totalCharge;

        /**
         * 当日运行时间
         */
        private long todayOnlineTime;


        /**
         * 当日开机率
         */
        private float todayOnlineRatio;

        public TodayInfo(BigDecimal todayDischarge,BigDecimal totalCharge, long todayOnlineTime, float todayOnlineRatio) {
            this.todayDischarge = todayDischarge;
            this.todayOnlineTime = todayOnlineTime;
            this.todayOnlineRatio = todayOnlineRatio;
            this.totalCharge = totalCharge;
        }
    }

    @Getter
    @Setter
    public static class DailyAvgInfo{
        /**
         * 数据日期
         */
        private Integer dataDate;
        /**
         * 充电量
         */
        private BigDecimal charge;

        /**
         * 耗电量
         */
        private BigDecimal discharge;

        /**
         * 平均耗电量
         */
        private BigDecimal avgDischarge;

        /**
         * 平均开机时长
         */
        private BigDecimal avgOnlineTime;

        /**
         * 开机率
         */
        private float onlineRatio;


    }

    public enum ElectricType{
        /**
         * 充电
         */
        CHARGE('1'),
        /**
         * 耗电
         */
        DISCHARGE('2');
        private char type;

        ElectricType(char type) {
            this.type = type;
        }

        public char getType() {
            return type;
        }
    }

    @Getter
    public static class Battery{
        private String vin;
        private String carNumber;
        private BigDecimal electricity;
        private ElectricType type ;

        public Battery(String vin,ElectricType type, String carNumber, BigDecimal electricity) {
            this.vin = vin;
            this.type = type;
            this.carNumber = carNumber;
            this.electricity = electricity;
        }
    }
}
